﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Modelo;

namespace Interface
{
    /// <summary>
    /// Interaction logic for Ventas.xaml
    /// </summary>
    public partial class Ventas : UserControl
    {
        string codigoSucursal = "1";
        Sucursal sucursal;
        public void addTab(UserControl control, string header)
        {
            TabItem item = new TabItem();
            item.Content = control;
            item.Header = header;
        
            Opciones.Items.Add(item);
            
        }
        public Ventas()
        {
            InitializeComponent();
            try
            {
                sucursal = Proceso.GestorSucursal.devolverSucursal(codigoSucursal);

            }
            catch (Exception)
            {
                MessageBox.Show("Excepcion inesperada, no se encontro sucursal", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
               
            }
            addTab(new RealizarVenta(sucursal), "Realizar venta");
            addTab(new VerSucursal(), "Consultar producto");
        }
    }
}
